<%@page import="modelo.Usuario"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%
	Usuario p = (Usuario) session.getAttribute("USUARIO_ACTUAL");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<!--  Version: Multiflex-3 Update-7 / Layout-3             -->
<!--  Date:    January 15, 2007                            -->
<!--  Author:  Wolfgang                                    -->
<!--  License: Fully open source without restrictions.     -->
<!--           Please keep footer credits with a link to   -->
<!--           Wolfgang (www.1-2-3-4.info). Thank you!     -->

<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="3600" />
<meta name="revisit-after" content="2 days" />
<meta name="robots" content="index,follow" />
<meta name="publisher" content="Your publisher infos here ..." />
<meta name="copyright" content="Your copyright infos here ..." />
<meta name="author"
	content="Design: Wolfgang (www.1-2-3-4.info) / Modified: Your Name" />
<meta name="distribution" content="global" />
<meta name="description" content="Your page description here ..." />
<meta name="keywords"
	content="Your keywords, keywords, keywords, here ..." />
<link href="css/bootstrap.css" rel="stylesheet">
<link href="assets/css/bootstrap-responsive.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" media="screen,projection,print"
	href="./css/layout3_setup.css" />
<link rel="stylesheet" type="text/css" media="screen,projection,print"
	href="./css/layout3_text.css" />
<link rel="icon" type="image/x-icon" href="./img/favicon.ico" />
<title>Principal :.</title>

<script>
       function validar(){
         var n = document.login.username.value;
         var c = document.login.password.value;

         if (n == ""){
            alert('Ingrese nombre');
            return false;
         } else if( c == ""){
            alert('Ingrese clave');
            return false;
         }
         return true;
       }
    </script>

</head>

<!-- Global IE fix to avoid layout crash when single word size wider than column width -->
<!--[if IE]><style type="text/css"> body {word-wrap: break-word;}</style><![endif]-->

<body>
	<!-- Main Page Container -->
	<div class="page-container">

		<!-- For alternative headers START PASTE here -->

		<!-- A. HEADER -->
		<div class="header">

			<!-- A.1 HEADER TOP -->
			<div class="header-top">

				<!-- Sitelogo and sitename -->
				<a class="sitelogo" href="#" title="Go to Start page"></a>
				<div class="sitename">
					<h1>
						<a href="index.html" title="Go to Start page">DESARROLLADORES
							<span style="font-weight: normal; font-size: 50%;">&nbsp;upc</span>
						</a>
					</h1>
					<h2>Sistema de Compra y Venta por Internet</h2>
				</div>

				<!-- Navigation Level 0 -->
				<div class="nav0">
					<ul>
						<li><a href="#" title="Homepage en Italiano"></a>
						</li>
					</ul>
				</div>

				<!-- Navigation Level 1 
				<div class="nav1">
					<ul>
						<li><a href="index.jsp" title="Principal">Principal</a></li>
						<li><a href="ventas.jsp" title="Ventas">Ventas</a></li>
						<li><a href="comprar.jsp" title="Compras">Compras</a></li>
						<li><a href="listadoaviso.jsp" title="Listado de Avisos">Avisos</a>
						</li>
					</ul>
				</div> -->
			</div>

			<!-- A.2 HEADER MIDDLE -->
			<div class="header-middle">

				<!-- Site message -->
				<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
					codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
					width="896" height="145">
					<param name="movie" value="img/Encabezado.swf" />
					<param name="quality" value="high" />
					<embed src="img/Encabezado.swf" quality="high"
						pluginspage="http://www.macromedia.com/go/getflashplayer"
						type="application/x-shockwave-flash" width="896" height="145"></embed>
				</object>
			</div>

			<!-- A.3 HEADER BOTTOM -->
			<div class="header-bottom">

				<!-- Navigation Level 2 (Drop-down menus) -->
				<div class="nav2">

					<!-- Navigation item -->
					<ul>
						<li><a href="index.jsp">Principal</a>
						</li>
					</ul>

					<!-- Navigation item -->
					<%
						if (p == null) {
					%>
					<ul>
						<li><a href="#">Publicaciones<!--[if IE 7]><!--> </a>
						<!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]-->
							<ul>
								<li><a href="FindPublicacion.jsp">Buscar
										Publicaci&oacute;n</a>
								</li>
							</ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--></li>
					</ul>

					<%
						}
					%>

					<!-- Navigation item -->
					<%
						if (p != null) {
							if (!p.getTipoUsuario().equals("administrador")) {
					%>
					<ul>
						<li><a href="#">Publicaciones<!--[if IE 7]><!--> </a>
						<!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]-->
							<ul>
								<li><a href="MantenimientoPublicaciones.jsp">Crear
										Publicaci&oacute;n</a>
								</li>
								<li><a href="FindPublicacion.jsp">Buscar
										Publicaci&oacute;n</a>
								</li>
								<li><a href="VentasYComprasXUsuario.jsp">Listar
										Publicaciones</a>
								</li>
							</ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--></li>
					</ul>

					<%
						}
						}
					%>

					<%
						if (p != null) {
							if (p.getTipoUsuario().equals("administrador")) {
					%>
					<ul>
						<li><a href="#">Administraci&oacute;n<!--[if IE 7]><!-->
						</a>
						<!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]-->
							<ul>
								<li><a href="prototipopersonas.jsp">Crear Usuario</a>
								</li>
								<li><a href="prototipocategorias.jsp">Crear Categoria</a>
								</li>
								<li><a href="registroaviso.jsp">Crear Aviso</a>
								</li>
							</ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--></li>
					</ul>

					<%
						}
						}
					%>
				</div>
			</div>

			<!-- A.4 HEADER BREADCRUMBS -->

			<!-- Breadcrumbs -->
			<div class="header-breadcrumbs">


				<!-- Search form -->
				<div class="searchform">
					<form action="index.html" method="get">
						<fieldset>
							<input name="field" class="field" value=" Buscar..." /> <input
								type="submit" name="button" class="button" value="Ir!" />
						</fieldset>
					</form>
				</div>
			</div>
		</div>

		<!-- For alternative headers END PASTE here -->

		<!-- B. MAIN -->
		<div class="main">

			<!-- B.1 MAIN CONTENT -->
			<div class="main-content">

				<!-- Pagetitle -->
				<h1 class="pagetitle">Principal / Inicio</h1>

				<!-- Content unit - One column -->
				<h1 class="block">1 - Bienvenidos</h1>
				<div class="column1-unit">
					<p>
						<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
							codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
							width="480" height="100" align="middle">
							<param name="movie" value="img/banner_049.swf" />
							<param name="quality" value="high" />
							<embed src="img/banner_049.swf" width="480" height="100"
								align="middle" quality="high"
								pluginspage="http://www.macromedia.com/go/getflashplayer"
								type="application/x-shockwave-flash"></embed>
						</object>
					</p>
				</div>
				<hr class="clear-contentunit" />

				<!-- Content unit - One column -->
				<h1 class="block">2 - Art&iacute;culos Recomendados</h1>
				<div class="column1-unit">
					<p>&nbsp;</p>

					<%@page import="modelo.Publicacion"%>
					<%@page import="negocio.GestionPublicacion"%>
					<%@page import="java.util.ArrayList"%>
					<%@page import="java.util.Iterator"%>
					<%
						GestionPublicacion negocio = new GestionPublicacion();
						ArrayList<Publicacion> listado = negocio
								.listarPublicacionesMasRecomendadas();
						Iterator i = listado.iterator();
						if (listado.size() > 0) {
							out.println("<div id=\"myCarousel\" class=\"carousel slide\">");
							out.println("<div class=\"carousel-inner\">");

							Publicacion publicacion = (Publicacion) i.next();
							out.println("<div class=\"item active\">");
							out.println("<table width=\"200\" border=\"1\">");
							out.println("<tr>");
							out.println("<th colspan=\"2\" scope=\"row\"><div align=\"center\"><h2>"
									+ publicacion.getTitulo() + "</h2></div></th>");
							out.println("</tr>");
							out.println("<tr>");
							out.println("<th scope=\"row\">Descripcion</th>");
							out.println("<td><div align=\"center\">"
									+ publicacion.getDescripcion() + "</div></td>");
							out.println("</tr>");
							out.println("<tr>");
							out.println("<th scope=\"row\">Estado</th>");
							out.println("<td><div align=\"center\">"
									+ publicacion.getEstado() + "</div></td>");
							out.println("</tr>");
							out.println("<tr>");
							out.println("<th scope=\"row\">Stock</th>");
							out.println("<td><div align=\"center\">"
									+ publicacion.getCantidad() + "</div></td>");
							out.println("</tr>");
							out.println("<tr>");
							out.println("<th scope=\"row\">Precio</th>");
							out.println("<td><div align=\"center\">"
									+ publicacion.getPrecio() + "</div></td>");
							out.println("</tr>");
							out.println("<tr>");
							out.println("<th scope=\"row\">Creado</th>");
							out.println("<td><div align=\"center\">"
									+ publicacion.getFechaCreacion() + "</div></td>");
							out.println("</tr>");
							out.println("<tr>");
							out.println("<th scope=\"row\">Duracion</th>");
							out.println("<td><div align=\"center\">"
									+ publicacion.getDuracion()
									+ " d&iacute;as </div></td>");
							out.println("</tr>");
							out.println("<tr>");
							out.println("<th scope=\"row\">Categoria</th>");
							out.println("<td><div align=\"center\">"
									+ publicacion.getCategoria().getNombre()
									+ "</div></td>");
							out.println("</tr>");
							out.println("<tr>");
							out.println("<th scope=\"row\">Fotos</th>");
							out.println("<td><div align=\"center\">"
									+ publicacion.getFotos() + "</div></td>");
							out.println("</tr>");
							out.println("</table>");
							out.println("</div>");

							while (i.hasNext()) {
								publicacion = (Publicacion) i.next();
								out.println("<div class=\"item\">");
								out.println("<table width=\"200\" border=\"1\">");
								out.println("<tr>");
								out.println("<th colspan=\"2\" scope=\"row\"><div align=\"center\"><h2>"
										+ publicacion.getTitulo() + "</h2></div></th>");
								out.println("</tr>");
								out.println("<tr>");
								out.println("<th scope=\"row\">Descripcion</th>");
								out.println("<td><div align=\"center\">"
										+ publicacion.getDescripcion() + "</div></td>");
								out.println("</tr>");
								out.println("<tr>");
								out.println("<th scope=\"row\">Estado</th>");
								out.println("<td><div align=\"center\">"
										+ publicacion.getEstado() + "</div></td>");
								out.println("</tr>");
								out.println("<tr>");
								out.println("<th scope=\"row\">Stock</th>");
								out.println("<td><div align=\"center\">"
										+ publicacion.getCantidad() + "</div></td>");
								out.println("</tr>");
								out.println("<tr>");
								out.println("<th scope=\"row\">Precio</th>");
								out.println("<td><div align=\"center\">"
										+ publicacion.getPrecio() + "</div></td>");
								out.println("</tr>");
								out.println("<tr>");
								out.println("<th scope=\"row\">Creado</th>");
								out.println("<td><div align=\"center\">"
										+ publicacion.getFechaCreacion() + "</div></td>");
								out.println("</tr>");
								out.println("<tr>");
								out.println("<th scope=\"row\">Duracion</th>");
								out.println("<td><div align=\"center\">"
										+ publicacion.getDuracion()
										+ " d&iacute;as </div></td>");
								out.println("</tr>");
								out.println("<tr>");
								out.println("<th scope=\"row\">Categoria</th>");
								out.println("<td><div align=\"center\">"
										+ publicacion.getCategoria().getNombre()
										+ "</div></td>");
								out.println("</tr>");
								out.println("<tr>");
								out.println("<th scope=\"row\">Fotos</th>");
								out.println("<td><div align=\"center\">"
										+ publicacion.getFotos() + "</div></td>");
								out.println("</tr>");
								out.println("</table>");
								out.println("</div>");
							}

							out.println("</div>");
							out.println("<a class=\"left carousel-control\" href=\"#myCarousel\"");
							out.println("data-slide=\"prev\">&lsaquo;</a> <a class=\"right carousel-control\"");
							out.println("href=\"#myCarousel\" data-slide=\"next\">&rsaquo;</a>");
							out.println("</div>");
						}
					%>

					<p>&nbsp;</p>
					<p>Garantia total por fallas de fabrica y asistencia tecnica.</p>
					<p>&nbsp;</p>

				</div>
				<hr class="clear-contentunit" />

				<!-- Content unit - One column -->
				<h1 class="block">3 - Art&eacute;culos m&aacute;s Vendidos</h1>
				<div class="column1-unit">
					<p>&nbsp;</p>

					<%@page import="modelo.Publicacion"%>
					<%@page import="negocio.GestionPublicacion"%>
					<%@page import="java.util.ArrayList"%>
					<%@page import="java.util.Iterator"%>
					<%
						negocio = new GestionPublicacion();
						listado = negocio.listarPublicacionesMasVendidas();
						i = listado.iterator();
						if (listado.size() > 0) {
							out.println("<div id=\"myCarousel2\" class=\"carousel slide\">");
							out.println("<div class=\"carousel-inner\">");

							Publicacion publicacion = (Publicacion) i.next();
							out.println("<div class=\"item active\">");
							out.println("<table width=\"200\" border=\"1\">");
							out.println("<tr>");
							out.println("<th colspan=\"2\" scope=\"row\"><div align=\"center\"><h2>"
									+ publicacion.getTitulo() + "</h2></div></th>");
							out.println("</tr>");
							out.println("<tr>");
							out.println("<th scope=\"row\">Descripcion</th>");
							out.println("<td><div align=\"center\">"
									+ publicacion.getDescripcion() + "</div></td>");
							out.println("</tr>");
							out.println("<tr>");
							out.println("<th scope=\"row\">Estado</th>");
							out.println("<td><div align=\"center\">"
									+ publicacion.getEstado() + "</div></td>");
							out.println("</tr>");
							out.println("<tr>");
							out.println("<th scope=\"row\">Stock</th>");
							out.println("<td><div align=\"center\">"
									+ publicacion.getCantidad() + "</div></td>");
							out.println("</tr>");
							out.println("<tr>");
							out.println("<th scope=\"row\">Precio</th>");
							out.println("<td><div align=\"center\">"
									+ publicacion.getPrecio() + "</div></td>");
							out.println("</tr>");
							out.println("<tr>");
							out.println("<th scope=\"row\">Creado</th>");
							out.println("<td><div align=\"center\">"
									+ publicacion.getFechaCreacion() + "</div></td>");
							out.println("</tr>");
							out.println("<tr>");
							out.println("<th scope=\"row\">Duracion</th>");
							out.println("<td><div align=\"center\">"
									+ publicacion.getDuracion()
									+ " d&iacute;as </div></td>");
							out.println("</tr>");
							out.println("<tr>");
							out.println("<th scope=\"row\">Categoria</th>");
							out.println("<td><div align=\"center\">"
									+ publicacion.getCategoria().getNombre()
									+ "</div></td>");
							out.println("</tr>");
							out.println("<tr>");
							out.println("<th scope=\"row\">Fotos</th>");
							out.println("<td><div align=\"center\">"
									+ publicacion.getFotos() + "</div></td>");
							out.println("</tr>");
							out.println("</table>");
							out.println("</div>");

							while (i.hasNext()) {
								publicacion = (Publicacion) i.next();
								out.println("<div class=\"item\">");
								out.println("<table width=\"200\" border=\"1\">");
								out.println("<tr>");
								out.println("<th colspan=\"2\" scope=\"row\"><div align=\"center\"><h2>"
										+ publicacion.getTitulo() + "</h2></div></th>");
								out.println("</tr>");
								out.println("<tr>");
								out.println("<th scope=\"row\">Descripcion</th>");
								out.println("<td><div align=\"center\">"
										+ publicacion.getDescripcion() + "</div></td>");
								out.println("</tr>");
								out.println("<tr>");
								out.println("<th scope=\"row\">Estado</th>");
								out.println("<td><div align=\"center\">"
										+ publicacion.getEstado() + "</div></td>");
								out.println("</tr>");
								out.println("<tr>");
								out.println("<th scope=\"row\">Stock</th>");
								out.println("<td><div align=\"center\">"
										+ publicacion.getCantidad() + "</div></td>");
								out.println("</tr>");
								out.println("<tr>");
								out.println("<th scope=\"row\">Precio</th>");
								out.println("<td><div align=\"center\">"
										+ publicacion.getPrecio() + "</div></td>");
								out.println("</tr>");
								out.println("<tr>");
								out.println("<th scope=\"row\">Creado</th>");
								out.println("<td><div align=\"center\">"
										+ publicacion.getFechaCreacion() + "</div></td>");
								out.println("</tr>");
								out.println("<tr>");
								out.println("<th scope=\"row\">Duracion</th>");
								out.println("<td><div align=\"center\">"
										+ publicacion.getDuracion()
										+ " d&iacute;as </div></td>");
								out.println("</tr>");
								out.println("<tr>");
								out.println("<th scope=\"row\">Categoria</th>");
								out.println("<td><div align=\"center\">"
										+ publicacion.getCategoria().getNombre()
										+ "</div></td>");
								out.println("</tr>");
								out.println("<tr>");
								out.println("<th scope=\"row\">Fotos</th>");
								out.println("<td><div align=\"center\">"
										+ publicacion.getFotos() + "</div></td>");
								out.println("</tr>");
								out.println("</table>");
								out.println("</div>");
							}

							out.println("</div>");
							out.println("<a class=\"left carousel-control\" href=\"#myCarousel2\"");
							out.println("data-slide=\"prev\">&lsaquo;</a> <a class=\"right carousel-control\"");
							out.println("href=\"#myCarousel2\" data-slide=\"next\">&rsaquo;</a>");
							out.println("</div>");
						}
					%>

					<p>&nbsp;</p>
					<p>Garantia total por fallas de fabrica y asistencia tecnica.</p>
					<p>&nbsp;</p>

				</div>
				<hr class="clear-contentunit" />

				<!-- Content unit - One column -->
				<h1 class="block">4 - Anuncios</h1>
				<div class="column1-unit">
					<p class="caption">Esta es la zona de anuncios</p>
					<p class="caption">
						<span class="credits"> <object
								classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
								codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
								width="480" height="80">
								<param name="movie" value="img/banner_044.swf" />
								<param name="quality" value="high" />
								<embed src="img/banner_044.swf" quality="high"
									pluginspage="http://www.macromedia.com/go/getflashplayer"
									type="application/x-shockwave-flash" width="480" height="80"></embed>
							</object> </span>
					</p>
				</div>
				<hr class="clear-contentunit" />






			</div>

			<!-- B.2 MAIN NAVIGATION -->
			<div class="main-navigation">

				<!-- Navigation Level 3 -->
				<div class="round-border-topleft"></div>


				<%
					if (p != null) {
				%>
				<h1>Conectado</h1>
				<h2>Bienvenido Usuario:</h2>
				<h3>
					${sessionScope.USUARIO_ACTUAL.nombres }
					${sessionScope.USUARIO_ACTUAL.paterno } <a href="LogoutServlet">(Salir)</a>
				</h3>

				<%
					} else {
				%>
				<!-- Login -->
				<h1>Ingreso</h1>
				<div class="loginform">
					<form name="login" method="post" action="LogeoServlet"
						onSubmit="return validar();">
						<p>
							<input type="hidden" name="rememberme" value="0" />
						</p>
						<p>&nbsp;</p>
						<p>&nbsp;</p>
						<fieldset>
							<p>
								<label for="username" class="top">Usuario:</label> <br /> <input
									type="text" name="username" id="username" tabindex="1"
									class="field"
									onKeyPress="return webLoginEnter(document.loginfrm.password);"
									value="" />
							</p>
							<p>
								<label for="password" class="top">Password:</label><br /> <input
									type="password" name="password" id="password" tabindex="2"
									class="field"
									onKeyPress="return webLoginEnter(document.loginfrm.cmdweblogin);"
									value="" />
							</p>
							<p>
								<input type="checkbox" name="checkbox_1" id="checkbox_1"
									class="checkbox" tabindex="3" size="1" value=""
									onClick="webLoginCheckRemember()" /> <label for="checkbox_1"
									class="right">Recordarme</label>
							</p>
							<p>
								<input type="submit" name="cmdweblogin" class="button"
									value="LOGIN" />
							</p>
							<p style="color: red;">${LOGUEO}</p>
						</fieldset>
					</form>
				</div>

				<%
					}
				%>


				<!-- Title -->

				<!-- Text formats -->
				<h1>Compras</h1>
				<h2>Las mas populares</h2>
				<h3>Texto</h3>
				<p>Texto</p>

				<h3>Enlaces</h3>
				<ul class="bullet">
					<li><a href="#">Link 1</a>
					</li>
					<li><a href="#">Link 2</a>
					</li>
					<li>Fact 1</li>
					<li>Fact 2</li>
				</ul>

				<h3>&nbsp;</h3>
				<h3>
					Imagenes<br />
				</h3>
				<p>
					<img src="./img/image.jpg" width="50" alt="Image description"
						title="Image title" />Descripcion.
				</p>
				<p>
					<img class="center" src="./img/image.jpg" width="50"
						alt="Image description" title="Image title" />
				</p>
				<p>
					<!-- Image Links -->
				</p>

				<h3>&nbsp;</h3>
			</div>
		</div>

		<!-- C. FOOTER AREA -->

		<div class="footer">
			<p>Copyright &copy; 2012 Desarrolladores | All Rights Reserved</p>
			<p class="credits">&nbsp;</p>
		</div>
	</div>

	<script src="js/jquery.js"></script>
	<script src="js/bootstrap-transition.js"></script>
	<script src="js/bootstrap-alert.js"></script>
	<script src="js/bootstrap-modal.js"></script>
	<script src="js/bootstrap-dropdown.js"></script>
	<script src="js/bootstrap-scrollspy.js"></script>
	<script src="js/bootstrap-tab.js"></script>
	<script src="js/bootstrap-tooltip.js"></script>
	<script src="js/bootstrap-popover.js"></script>
	<script src="js/bootstrap-button.js"></script>
	<script src="js/bootstrap-collapse.js"></script>
	<script src="js/bootstrap-carousel.js"></script>
	<script src="js/bootstrap-typeahead.js"></script>
</body>
</html>



